package alpha.unibratec;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.Parser;
import org.xml.sax.SAXException;

import alpha.unibratec.comunicacao.ComunicacaoWS;
import android.R.integer;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class SuperSenha_MobileActivity extends Activity implements
		OnClickListener {

	private Button but_login;
	private Button but_cadastroUsuario;
	private EditText edt_email;
	private EditText edt_senha;

	ComunicacaoWS comunicacao = new ComunicacaoWS();
	public static String resultadoLogin = "";
	public String res;

	String email;
	String senha;
	int usuario;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		but_login = (Button) findViewById(R.id.but_login);
		but_cadastroUsuario = (Button) findViewById(R.id.but_cadastroUsuario);
		but_login.setOnClickListener(this);
		but_cadastroUsuario.setOnClickListener(this);

		edt_email = (EditText) findViewById(R.id.edt_email);
		edt_senha = (EditText) findViewById(R.id.edt_senha);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.but_login:
			/*
			 * switch (v.getId()) { case R.id.but_login: Toast.makeText(this,
			 * "LOGADO", Toast.LENGTH_SHORT).show(); try { chamadaWBS_Login();
			 * email = edt_email.getText().toString(); String msg_login =
			 * "Bem Vindo " + email; if (res.equals(msg_login)) {
			 * Toast.makeText(this, resultadoLogin, Toast.LENGTH_SHORT) .show();
			 */
			Intent int_Login = new Intent(SuperSenha_MobileActivity.this,
					MenuInicialActivity.class);
			// int_Login.putExtra("email", resultadoLogin);
			startActivity(int_Login);
			/*
			 * } else { Toast.makeText(this, resultadoLogin, Toast.LENGTH_SHORT)
			 * .show(); } } catch (Exception e) { e.getMessage(); } break;
			 * 
			 * default: break; }
			 */

			// }

			/*
			 * public void chamadaWBS_Login() { try { email =
			 * edt_email.getText().toString(); senha =
			 * edt_senha.getText().toString(); usuario = 01; String id =
			 * String.valueOf(usuario);
			 * 
			 * comunicacao = new ComunicacaoWS(); resultadoLogin =
			 * comunicacao.autenticarLogin(usuario, email, senha) .toString();
			 * SuperSenha_MobileActivity.resultadoLogin = res; } catch
			 * (Exception e) { SuperSenha_MobileActivity.resultadoLogin =
			 * e.toString(); } }
			 */
			break;
		case R.id.but_cadastroUsuario:
			Intent int_cadastrarUsuario = new Intent(this, CadastrarUsuarioActivity.class);
			startActivity(int_cadastrarUsuario);
			break;
		default:
			break;
		}
	}
}